﻿using CatUtils.Utils.Currency.IoUtils;

using CatUtils.Utils.SpecialUtils.View;
using RabbitDownload.Helper;

using RabbitDownload.WebSite.Local;
using System.Collections.Generic;
using System.Windows.Forms;

namespace RabbitDownload.ViewcCntrol
{
    internal class ComboboxSelectChange
    {
        public readonly static List<string> MainList = new List<string>() { "E-hentai", "Konachan", "P站", "Yande", "Zerochan", "半次元", "花瓣网", "萌图兔", "工具箱" };
        private readonly static List<string> PixivList = new List<string>() { "主菜单", "P站日榜", "P站日榜(批量)", "P站标签", "P站标签(登录)", "P站画师", "Pixivision", "PID递增", "P站相关推荐", "Pixiv DIC", "P站数据清理" };

        private readonly static List<string> BcyList = new List<string>() { "主菜单", "半次元文章（单个）", "半次元搜索", "半次元标签" };

        private readonly static List<string> KonachanList = new List<string>() { "主菜单", "K站（全部）", "K站标签", "Konachan 画集（POOL）", "获取标签（K站）" };

        private readonly static List<string> YandeList = new List<string>() { "主菜单", "Yande（全部）", "Yande标签", "Yande标签（批量）", "Yande标签批量", "Yande 画集（POOL）", "获取标签（Yande）" };
        private readonly static List<string> MoetutuList = new List<string>() { "主菜单", "萌图兔(全部)", "萌图兔搜索", "萌图兔标签" };
        private readonly static List<string> EhentaiList = new List<string>() { "主菜单", "E站分类", "E站单个", "E站标签" };
        public static GroupBox LocalGroupBox = null;

        /// <summary>
        /// 初始化选择器
        /// </summary>
        /// <param name="groupBox1"></param>
        public static void InitGroupBox(GroupBox groupBox1)
        {
            LocalGroupBox = groupBox1;
        }

        internal static void SelectChange(GroupBox groupBox1, ComboBox comboBox1, string text)
        {
            if (text == "")
                return;
            Groupboxhelper.SaveSelectChanged(text, Groupboxhelper.DefaultViewName);

            //这是选择的父类
            switch (text)
            {
                case "主菜单":

                    ViewChanged(comboBox1, MainList);
                    return;

                case "P站":
                    ViewChanged(comboBox1, PixivList);

                    return;

                case "半次元":
                    ViewChanged(comboBox1, BcyList);

                    return;

                case "萌图兔":
                    ViewChanged(comboBox1, MoetutuList);

                    return;

                case "E-hentai":
                    ViewChanged(comboBox1, EhentaiList);

                    return;

                case "Konachan":
                    ViewChanged(comboBox1, KonachanList);

                    return;

                case "Yande":
                    ViewChanged(comboBox1, YandeList);

                    return;
            }
            //从这里开始是子类标签
            switch (text)
            {
                case "工具箱":
                    Groupboxhelper.Replace(groupBox1, new LocalToolControl());
                    return;

                case "半次元标签":

                    Groupboxhelper.Replace(groupBox1, new WebSite.Bcy.Tag.BcyTagControl());
                    return;

                case "半次元搜索":

                    Groupboxhelper.Replace(groupBox1, new WebSite.Bcy.Search.BcySearchControl());
                    return;

                case "半次元文章（单个）":

                    Groupboxhelper.Replace(groupBox1, new WebSite.Bcy.Single.BcySingleControl());
                    return;

                case "P站画师":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.PixivArt.PixivArtBatchControl());
                    return;

                case "萌图兔(全部)":
                    Groupboxhelper.Replace(groupBox1, new WebSite.MoeRabbit.MoeRAll.MoeRabbitAllControl());
                    return;

                case "E站分类":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Ehentai.EhentatControl());
                    return;

                case "E站标签":

                    Groupboxhelper.Replace(groupBox1, new WebSite.Ehentai.ExTagControl());
                    return;

                case "K站（全部）":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Konachan.ALL.KonachanAllControl());
                    return;

                case "K站标签":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Konachan.Tag.KonachanTagControl());
                    return;

                case "获取标签（K站）":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Konachan.GetTag.KonachanGetTagControl());
                    return;

                case "Konachan 画集（POOL）":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Konachan.Pool.KonachanPoolControl());
                    return;

                case "Yande（全部）":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Yande.All.YandeAllControl());
                    return;

                case "Yande标签":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Yande.Tag.YandeTagControl());
                    return;

                case "Yande标签（批量）":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Yande.Tag.YandeBatchTagControl());
                    return;

                case "Yande 画集（POOL）":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Yande.Pool.YandePoolControl());
                    return;

                case "P站日榜":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.PixivDay.EveryDayControl());
                    return;

                case "P站标签":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.PixivTag.PixivTagControl());
                    return;

                case "P站日榜(批量)":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.PixivDay.EveryDayBatchControl());
                    return;

                case "Pixivision":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.Pixivision.PixivisionControl());
                    return;

                case "P站标签(登录)":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.PixivTagMember.PixivTagMemControl());
                    return;

                case "PID递增":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.Successive.SuccessiveControl());
                    return;

                case "P站相关推荐":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.PixivRelevant.PixivRelevantControl());
                    return;

                case "Pixiv DIC":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.PixivDic.PixivDicControl());
                    return;

                case "P站数据清理":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Pixiv.ClearData.ClearControl());
                    return;

                case
                     "E站单个":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Ehentai.EhentaiSingleControl());
                    return;

                case "Zerochan":
                    Groupboxhelper.Replace(groupBox1, new WebSite.Zerochan.ZerochanControl());
                    return;
            }
        }

        private static void ViewChanged(ComboBox comboBox1, List<string> ComboxList)
        {
            new ViewAsyncUpdate().ComboBoxClearItem(comboBox1);

            new ViewAsyncUpdate().ComboBoxAddItemList(comboBox1, ComboxList);
            new ViewAsyncUpdate().ComboBoxDropped(comboBox1, true);
        }
    }
}